/*
 * Copyright 2020 The Kubernetes Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@use 'sass:math';
@import 'mixins';

$input-padding: 1em;
$margin-for-right-elements: calc(#{math.div(0.875 * $input-padding, $right-element-font-size-factor)} + 1px) 0;

.kui--18px {
  @include ReplayedBlock {
    @include Input {
      font-size: 0.875em;
    }
  }
}

@include Block {
  @include NotEditable {
    max-width: $max-column-width;
  }
}

/** These are special stylings for read only mode, for example, we don't want to show all block actions */
@include Scrollback {
  @include FinishedBlock {
    @include NotEditableAndExecutable {
      @include show-block-action-buttons;

      @include InputWrapper {
        padding-left: $input-padding;

        @include Input {
          padding: #{0.875 * $input-padding} 0;
          padding-right: $input-padding;
        }

        /** Adjust and always show timestamp */
        @include BlockTimestamp {
          margin: $margin-for-right-elements;
          margin-right: 0.25em;
        }
        &:hover {
          @include BlockTimestamp {
            opacity: 1;
          }
        }
      }

      @include Context {
        padding: #{0.875 * $input-padding} 0;
      }

      @include BlockActions {
        position: unset;
        background-color: transparent;

        &[data-has-been-rerun] {
          @include BlockAction {
            color: var(--color-gray);
          }
        }
      }
    }
  }
}
